package com.dfbz.springboot_project.mapper;

import com.dfbz.springboot_project.entity.Role;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;

public class AdminRoleProvider {
    public String InsertSelective(@Param("Aid") Integer Aid,@Param("roles") ArrayList<Role> roles){
        StringBuilder sb = new StringBuilder();
        sb.append("INSERT INTO `netctoss`.`admin_role`(`admin_id`, `role_id`) VALUES ");
        for (int i = 0; i < roles.size(); i++) {
            sb.append("(#{Aid}, #{roles["+i+"].roleId}),");
        }
        sb.deleteCharAt(sb.length()-1);
        return sb.toString();
    }
}
